<template>
    <div class="fullScreen bg-c-wh tx-c tx-c-666">
        <m-header :msg="'邀请'"></m-header>
        <div class="logo"></div>
        <div class="tx-c-o">邀请码：{{data.yqm}}</div>
        <div class="tx-s-14 mar-t-1">邀请链接：{{data.shareurl}}</div>
        <div class="copy" @click="copy(data.shareurl)">复制链接</div>
        <!-- <div class="code icon" :style="{backgroundImage: 'url(' + data.QRcods + ')'}"></div>
        <div>扫码下载App更多玩法等着你来</div> -->
    </div>
</template>
<script type="text/ecmascript-6">
import 'common/css/user.css'
import MHeader from '../../components/m-header'
import { isEmptyObject } from '../../common/js/common'
import { inviCode } from '../../common/js/axiosUtil' 
export default { 
    data() {
        return { 
            data : ''
        }
    },
    created() {
        this.getData()
    },
    methods: {
        // 复制链接
        copy (message) {
            const input = document.createElement("input")
            input.value = message
            document.body.appendChild(input)
            input.select()
            input.setSelectionRange(0, input.value.length), document.execCommand('Copy')
            document.body.removeChild(input)
            this.$toast('已复制', 2000)
        },
        // 获取邀请数据
        getData(){
            let params = this.$params(1)
            inviCode(params)
            .then((response)=> {
                if(response.data.code == "200"){
                    this.data = response.data.data
                } else {
                    this.$logAgain(response.data.msg)
                }
            })
            .catch((error)=> {
                this.$toast('请求服务失败', 2000)
            });
        }
    },
    components: {
        MHeader
    }
}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
    .logo
        width: 4rem
        height: 2.875rem
        margin: 2rem auto
        background-size: 100% 100%
        background-image: url('../../common/image/yq_logo.png')
    .copy
        width: 4rem
        padding: .5rem
        margin: .75rem auto
        border: 1px solid #c1c1c1
    .inp_copy
        opacity: 0
        position: absolute
    .code
        width: 10rem
        height: 10rem
        margin: 2rem auto 1rem auto
        background-size: 100% 100%
    .icon
        background-image: url('../../common/image/144.png')
</style>

